package org.boyan.modules.cgform.converter;

import java.util.Map;
import org.springframework.stereotype.Component;

/**
 * @author: zhuxiaobao
 * @time: 2021/9/26 11:08
 */

@Component("customDemoConverter")
public class c implements FieldCommentConverter {
    @Override
    public String converterToVal(String txt) {
        if (txt != null && txt.equals("管理员1")) {
            return "admin";
        }
        return txt;
    }

    @Override
    public String converterToTxt(String val) {
        if (val != null) {
            if (val.equals("admin")) {
                return "管理员1";
            }
            if (val.equals("scott")) {
                return "管理员2";
            }
        }
        return val;
    }

    @Override
    public Map<String, String> getConfig() {
        return null;
    }
}